home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / private / _setfont.c < prev    next >
C/C++ Source or Header  |  1993-06-18  |  3KB  |  151 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__setfont = "$Header: C:\CURSES\private\RCS\_setfont.c 2.1 1993/06/18 20:23:45 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_set_font()    - sets the current font size
  14.  
  15.   PDCurses Description:
  16.      This is a private PDCurses function.
  17.  
  18.      This routine sets the current font size, if the adapter allows
  19.      such a change.
  20.  
  21.   PDCurses Return Value:
  22.      This function returns OK upon success otherwise ERR is returned.
  23.  
  24.   PDCurses Errors:
  25.      It is an error to attempt to change the font size on a "bogus"
  26.      adapter.  The reason for this is that we have a known video
  27.      adapter identity problem.  e.g. Two adapters report the same
  28.      identifying characteristics.
  29.  
  30.      It is also an error to attempt to change the size of the Flexos
  31.      console (as there is currently no support for that).
  32.  
  33.   Portability:
  34.      PDCurses    int    PDC_set_font( int size );
  35.  
  36. **man-end**********************************************************************/
  37.  
  38. int    PDC_set_font(int size)
  39. {
  40. #ifdef    OS2
  41.     VIOMODEINFO modeInfo;
  42. #endif
  43.  
  44. #ifdef PDCDEBUG
  45.     if (trace_on) PDC_debug("PDC_set_font() - called\n");
  46. #endif
  47.  
  48. #ifdef    FLEXOS
  49.     return( ERR );
  50. #endif
  51.  
  52. #ifdef    DOS
  53.     if (_cursvar.bogus_adapter)
  54.         return( ERR );
  55.  
  56.     switch (_cursvar.adapter)
  57.     {
  58.     case _CGA:
  59.     case _MDA:
  60.     case _MCGACOLOR:
  61.     case _MCGAMONO:
  62.     case _MDS_GENIUS:
  63.         break;
  64.  
  65.     case _EGACOLOR:
  66.     case _EGAMONO:
  67.         if (_cursvar.sizeable && (_cursvar.font != size))
  68.         {
  69.             switch (size)
  70.             {
  71.             case _FONT8:
  72.                 regs.h.ah = 0x11;
  73.                 regs.h.al = 0x12;
  74.                 regs.h.bl = 0x00;
  75.                 int86(0x10, ®s, ®s);
  76.                 break;
  77.             case _FONT14:
  78.                 regs.h.ah = 0x11;
  79.                 regs.h.al = 0x11;
  80.                 regs.h.bl = 0x00;
  81.                 int86(0x10, ®s, ®s);
  82.                 break;
  83.             default:
  84.                 break;
  85.             }
  86.         }
  87.         break;
  88.  
  89.     case _VGACOLOR:
  90.     case _VGAMONO:
  91.         if (_cursvar.sizeable && (_cursvar.font != size))
  92.         {
  93.             switch (size)
  94.             {
  95.             case _FONT8:
  96.                 regs.h.ah = 0x11;
  97.                 regs.h.al = 0x12;
  98.                 regs.h.bl = 0x00;
  99.                 int86(0x10, ®s, ®s);
  100.                 break;
  101.             case _FONT14:
  102.                 regs.h.ah = 0x11;
  103.                 regs.h.al = 0x11;
  104.                 regs.h.bl = 0x00;
  105.                 int86(0x10, ®s, ®s);
  106.                 break;
  107.             case _FONT16:
  108.                 regs.h.ah = 0x11;
  109.                 regs.h.al = 0x14;
  110.                 regs.h.bl = 0x00;
  111.                 int86(0x10, ®s, ®s);
  112.                 break;
  113.             default:
  114.                 break;
  115.             }
  116.         }
  117.         break;
  118.     default:
  119.         break;
  120.     }
  121.     if (_cursvar.visible_cursor)
  122.         curson();
  123.     else
  124.         cursoff();
  125.     _cursvar.font = PDC_get_font();
  126.     return( OK );
  127. #endif
  128.  
  129. #ifdef    OS2
  130.     if (_cursvar.sizeable && (_cursvar.font != size))
  131.     {
  132.            modeInfo.cb = sizeof(modeInfo);
  133.            /* set most parameters of modeInfo */
  134.            VioGetMode(&modeInfo, 0);
  135.            modeInfo.cb = 8;     /* ignore horiz an vert resolution */
  136.                modeInfo.row = modeInfo.vres / size;
  137.            VioSetMode(&modeInfo, 0);
  138.     }
  139.     if (_cursvar.visible_cursor)
  140.         curson();
  141.     else
  142.         cursoff();
  143.     _cursvar.font = PDC_get_font();
  144.     return( OK );
  145. #endif
  146.  
  147. #ifdef UNIX
  148.     return(OK); /* this is N/A */
  149. #endif
  150. }
  151.